package com.zbd.microservices.security;

import javax.inject.Inject;
import javax.sql.DataSource;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
import org.springframework.stereotype.Component;

@Component("jdbcClientDetailsServiceCache")
public class JdbcClientDetailsServiceCache extends JdbcClientDetailsService{
    @Inject DataSource dataSource;
    
	public JdbcClientDetailsServiceCache(DataSource dataSource) {
		super(dataSource);
	}
	
    @Cacheable(value="loadClientByClientId" , keyGenerator = "DKeyGenerator")
	public ClientDetails loadClientByClientId(String clientId) throws InvalidClientException {
		return super.loadClientByClientId(clientId);
	}

}
